package com.tian.user.feign;


import com.tian.authen.api.feign.AuthenFeign;
import com.tian.authen.api.feign.request.OauthAccessTokenId;
import com.tian.common.result.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.tian.authen.api.feign.response.OauthAccessTokenResponse;

import java.util.List;


/**
 * @author zhump
 */
@Component
public class AuthenFeignClient {

    @Autowired
    private AuthenFeign authenFeign;


    /**
     * <pre>
     *     通过fegin远程去校验token是否有效。
     * </pre>
     * @param token 请求头token
     * @return
     */
    public OauthAccessTokenResponse getToken(String token){
        OauthAccessTokenId bean = new OauthAccessTokenId();
        bean.setToken(token);
        BaseResult<OauthAccessTokenResponse> result = authenFeign.getToken(bean);
        return result.getData();
    }
}
